<script setup lang="ts">
import { ref, withDefaults } from 'vue'
import { IUser } from '../../interface.ts'

// 定义 Props 并设置默认值
const props = withDefaults(defineProps<{ user: IUser }>(), {
  user: (): IUser => ({
    name: '子组件',
    age: 0,
    sex: '',
    address: ''
  })
})
</script>

<template>
  <!-- 我是子组件 -->
  <div>{{ props.user.name }}</div>
  <div>{{ props.user.sex }}</div>
</template>